<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>创建短信任务</title>
    <link type="text/css" href="/static/layui/v2.6.7/css/layui.css" rel="stylesheet"/>
    <script type="text/javascript" src="/static/js/jquery-1.8.3.min.js"></script>
    <script type="text/javascript" src="/static/layui/v2.6.7/layui.js"></script>
    <style type="text/css">
        .width_100{
            width:100px!important;
        }
        .width_200{
            width:200px!important;
        }
        .width_250{
            width:250px!important;
        }
        .width_300{
            width:300px!important;
        }
        .width_400{
            width:400px!important;
        }
        .required{
            color: red;
        }
    </style>
</head>
<body>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
    <legend>创建短信任务</legend>
</fieldset>
<br/>
<form class="layui-form" action="" id="form" onsubmit="return false" style="margin-left: 100px;">

    <div class="layui-form-item">
        <label class="layui-form-label"> 任务名称</label>
        <div class="layui-input-inline width_400">
            <input type="text" name="title" id="title" placeholder="任务名称" value="{$param['title']}" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">类型：</label>
        <div class="layui-input-inline">
            <select name="type" id="type" lay-filter="type">
                <option value="0">混合</option>
                <option value="1">纯付费</option>
                <option value="2">纯普通玩家</option>
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"> 付费金额</label>
        <div class="layui-input-inline width_100">
            <input type="text" name="min_money_pay" id="min_money_pay" value="{$param['min_money_pay']}" placeholder="" autocomplete="off" class="layui-input">
        </div>
        <div class="layui-form-mid">-</div>
        <div class="layui-input-inline width_100">
            <input type="text" name="max_money_pay" value="{$param['max_money_pay']}" placeholder="" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"> 需要付费数</label>
        <div class="layui-input-inline width_250">
            <input type="text" name="pay_num" id="pay_num" value="{$param['pay_num']}" placeholder="" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"> 需要0元付费数</label>
        <div class="layui-input-inline width_250">
            <input type="text" name="pay_num_zero" id="pay_num_zero" value="{$param['pay_num_zero']}" placeholder="" autocomplete="off" class="layui-input">
        </div>
    </div>

    <br><br><br><br><br>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="form">提交</button>
            <button class="layui-btn layui-btn-primary" id="back_history" onclick="closeThisWindow()">关闭</button>
        </div>
    </div>
    <br><br><br><br><br><br>

</form>
<script type="text/javascript">
    var loading = '';
    layui.use(['laydate','form'], function(){
        var form = layui.form;
        var laydate = layui.laydate;

        laydate.render({
            elem: '#starttime_reg',
            range: true
        });
        laydate.render({
            elem: '#starttime_login',
            range: true
        });
        laydate.render({
            elem: '#starttime_pay',
            range: true
        });
        //监听提交
        form.on('submit(form)', function(data){
            $.ajax({
                type: "post",
                url: "/?r=smsTask/add",
                data: $('#form').serialize(),
                dataType: "json",
                "beforeSend": function(){
                    loading = layer.load(1, { shade: [0.5, '#fff'] });
                },
                success: function (res) {
                    layer.close(loading);
                    if (res.code == 1) {
                        layer.msg(res.message, { icon:1, time:1500, shade:[0.6,'#000',true] }, function(){
                            closeThisWindow();
                        });
                    }else{
                        layer.msg(res.message, { icon:2, time:1500, shade:[0.6,'#000',true] });
                    }
                },
                error: function () {
                    layer.confirm("访问服务器出错", { icon: 2,title:'错误提示',btn : [ '确定'] });
                    layer.close(loading);
                }
            });
        });
    });
    function closeThisWindow() {
        parent.layer.closeAll();
    }
</script>
</body>
</html>